package autoconfigure.marker;

import autoconfigure.aspect.SlowQueryAspect;
import autoconfigure.config.SlowProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;

/**
 * @author zengjw
 * @Description
 * @CreateTime 2023-02-27
 **/
public class SlowAutoConfig {
    /**
     * 配置自定注入
     * @return
     */
    @Bean
    @Order(-1)
    public SlowProperty slowProperty(){
        return new SlowProperty();
    }

    /**
     * 慢查询切面
     * @param slowProperty
     * @return
     */
    @Bean
    @Order(2)
    @ConditionalOnBean(SlowProperty.class)
    public SlowQueryAspect slowQueryAspect(SlowProperty slowProperty){
        return new SlowQueryAspect(slowProperty);
    }
}
